﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Devices.Geolocation;

namespace SNSComponent.Utiltiy
{
    public static class LocationUtility
    {
        static Geolocator geolocator = new Geolocator();



        public static async Task<Geoposition> GetLocation()
        {
            try
            {
                Geoposition geoposition = await geolocator.GetGeopositionAsync(
                           maximumAge: TimeSpan.FromMinutes(10),
                           timeout: TimeSpan.FromSeconds(10)
                           );

                return geoposition;

            }
            catch(Exception ex)
            {
                if ((uint)ex.HResult == 0x80004004)
                {
                   
                }
                //else
                {
                    
                }
                throw ex;
            }
        }
    }
}
